    var fadeTime = 500;

    //set style in page(theme, font) and save page in localstorage
    function setStyle(befoPage){ 
        var color = window.localStorage.getItem("appColor"); 
        $('html').addClass('ui-page-theme-'+color);
        
        window.localStorage.setItem("befoPage", befoPage);
        
        var size = window.localStorage.getItem("appSize");
        if (size == null)
            size = 0;
        
        var heightClient = document.body.clientHeight;
        var pers = heightClient / 760;
        var s = document.body.style;
        s.fontSize = (parseInt(16 * pers) + parseInt(size)) + 'px';
          
        if (color == null)
            color = 'b';
        $('#options').removeClass('ui-page-theme-b').addClass('ui-page-theme-'+color);
        
        if (window.localStorage.getItem("cFade") == 'on'){
            $("body").css("display", "none");
            $("body").fadeIn(fadeTime);
        }
    } 

    //get app database
    function getBD(){
        var db = window.openDatabase("test", "1.0", "Test DB", 1000000);
        return db;
    }
    
    //error
    function errorCB(err) {
        console.log("(errorCB)Error processing SQL: "+err.code);
    }
    
    // Transaction error callback
    function errorCB(tx, err) {
        console.log("Error processing SQL: "+err);
    }

    // Transaction success callback
    function successCB() {
        console.log("success!");
    }    
    
    //list count in setting 
    function getListCount(){
        var listCount = window.localStorage.getItem("listCount");
        if (listCount == null)
            listCount = 15;
        return listCount;
    }

    //get request from http
    function getUpdateRequest(){
        var Params = location.search.substring(1);
        return Params;
    }

    //get param from http request
    //return param or "" if not find param with this name
    function getParam(sParamName){
        var Params = location.search.substring(1).split("&"); 
        var variable = "";
        for (var i = 0; i < Params.length; i++){ 
            if (Params[i].split("=")[0] == sParamName){ 
                if (Params[i].split("=").length > 1) variable = Params[i].split("=")[1];
                return variable;
            }
        }
        return "";
    }
    
    // in http set new value in request
    // return all http with new param
    function setParam(sParamName, sParamValue){
        var Params = location.search.substring(1).split("&");
        var variable = location.href.slice(0,window.location.href.indexOf('\?'));
        for (var i = 0; i < Params.length; i++){ 
            if (Params[i].split("=")[0] == sParamName){ 
                var buf = Params[i].split("=")[0];
                buf = buf + "=" + sParamValue;
                Params[i] = buf;
            }
            if(i == 0){
                variable = variable + "?" + Params[i];
            }else{
                variable = variable + "&" + Params[i];
            }
        }
        //return all patch with new param
        return variable;
    }
    
    function parseUnixTimeStamp(unix_timestamp){
        var date = new Date(unix_timestamp*1000);
         // hours part from the timestamp
         var hours = parseInt(date.getHours())+1;
         // minutes part from the timestamp
         var minutes = date.getMinutes();
         // seconds part from the timestamp
         var seconds = date.getSeconds();
         // year part from the timestamp
         var year = date.getFullYear();
         // month part from the timestamp
         var month = parseInt(date.getMonth())+1;
         // date part from the timestamp
         var date = date.getDate();
    
         // will display time in 22.1.2014 10:30:23 format
         var formattedTime = year + '.' + month + '.' + date + ' ' + 
                             hours + ':' + minutes + ':' + seconds+' МСК';
         
         return formattedTime;
    }
    
    
    //go to new page
    var page;
    function goToPage(_page){
        if (window.localStorage.getItem("cFade") == 'on'){
            page = _page;
            $("body").fadeOut(fadeTime, redirectPage);
        }else{
            window.location = _page;
            //$.mobile.loadPage( _page, {role: "dialog"});
            //console.log(_page);
            //$.mobile.changePage(_page, { transition: "flip"});
        }
    }
    
    //go to new page with fadein
    function redirectPage(){
        window.location = page;
    }